﻿<Window x:Class="ExportLSDbasScript.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Visual Studio LightSwitch application DB script generator" Name="main">
    <Grid Margin="20,20,20,20">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="*" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>
        
        <StackPanel Orientation="Horizontal" 
                    Background="Wheat" 
                    Grid.Column="0" 
                    Grid.Row="0" 
                    HorizontalAlignment="Stretch">
            <TextBlock Name="txtbFolder" 
                       Margin="0,5,0,0" 
                       FontSize="14" 
                       FontFamily="Calibri" 
                       FontWeight="Bold" 
                       TextOptions.TextRenderingMode="Grayscale" 
                       Text="Please select the folder where your LightSwitch application is.." />
            <Button Content="Browse" 
                    Margin="30,0,30,0" 
                    HorizontalAlignment="Right"
                    Name="btnBrowse" 
                    Click="btnBrowse_Click"  />
        </StackPanel>

        <RichTextBox  Name="rtxtTables" 
                      Foreground="Blue" 
                      IsReadOnly="True" 
                      Grid.Row="1" 
                      HorizontalAlignment="Stretch" 
                      VerticalAlignment="Stretch" 
                      HorizontalScrollBarVisibility="Auto" 
                      VerticalScrollBarVisibility="Auto" />
        
        <StackPanel  Grid.Row="2" Background="Wheat" >
            <TextBlock Name="txtProg" 
                       Margin="0,5,0,0" 
                       Foreground="Red" 
                       FontWeight="ExtraBold" 
                       FontFamily="Calibri" 
                       FontSize="14" />
        </StackPanel>

        <Popup Name="popupListDB" Height="350" Width="550" Placement="Center">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="25" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="25"/>
                </Grid.RowDefinitions>
                <TextBlock Name="txtbList" 
                           Grid.Column="0" 
                           Grid.Row="0" 
                           Margin="0,3,0,0" 
                           FontWeight="ExtraBold"  
                           Foreground="FloralWhite" 
                           Text="Select the database(s) to Export as script" />
                <ListBox Name="lstData" 
                         Grid.Row="1" 
                         Grid.Column="0" 
                         SelectionMode="Multiple" 
                         SelectionChanged="lstData_SelectionChanged">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding DatabaseName}" Width="Auto" />
                                <TextBlock Text="{Binding DatabaseSize}" Margin="25,0,0,0"/>
                                <CheckBox Margin="25,0,0,0" 
                                          Name="chkDrop" 
                                          Click="chkDrop_Click" 
                                          IsChecked="True"  
                                          Content="Drop if already exists." />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="0">
                    <TextBlock Name="txtError" 
                               Margin="0,3,0,0" 
                               FontWeight="ExtraBold" 
                               HorizontalAlignment="Right" 
                               Foreground="Red" />
                </StackPanel>

                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="0">
                    <Button Name="btnOk" 
                            Width="50" 
                            Content="OK" 
                            Click="btnOk_Click"/>
                    <Button Name="btnCancel" 
                            Content="Cancel" 
                            Width="50" 
                            Margin="30,0,0,0" 
                            Click="btnCancel_Click"/>
                </StackPanel>
            </Grid>
        </Popup>

    </Grid>

</Window>
